package com.aner.test.controller;
import com.aner.tester.controller.BaseControllerTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.aner.tester.utils.text.StringUtils;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * PatchTestControllerTest class
 * 
 * @author aner
 * @date 2020-12-30
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
public class PatchTestControllerTest extends BaseControllerTest
{

    @Test
    public void testTest() {
        String params = "{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.21901498147106124,'floatTest':0.39812136,'intTest':1,'longTest':2,'stringTest':'三尔小公5'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patch("/test/", jsonStr);
        
    }
    @Test
    public void testRequestParamDateTest() {
        String params = "{'testDate':'2020-12-30 13:39:02'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patch("/testRequestParamDate/", jsonStr);
        
    }
    @Test
    public void testRequestBodyDateTest() {
        String params = "1609306742175";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patchBody("/testRequestBodyDate/", jsonStr);
        
    }
    @Test
    public void testRequestBodyListTest() {
        String params = "['小个小广尔省','广故']";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patchBody("/testRequestBodyList/", jsonStr);
        
    }
    @Test
    public void testRequestParamListTest() {
        String params = "{'testList':['猫的个','的狗尔事小故']}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patch("/testRequestParamList/", jsonStr);
        
    }
    @Test
    public void testRequestBodyMapTest() {
        String params = "{'的狗个小尔':'0972','小广小1三':'14018'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patchBody("/testRequestBodyMap/", jsonStr);
        
    }
    @Test
    public void testRequestBodyLongTest() {
        String params = "3";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patchBody("/testRequestBodyLong/", jsonStr);
        
    }
    @Test
    public void testPathVariableTest() {
        String params = "{'params':['小狗','个1小','猪猪事个事尔','告41广','省个小广小猪','的小小小猪'],'id':[0,0,2,0,3,3]}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patch("/testPathVariable/{params}/{id}", jsonStr);
        
    }
    @Test
    public void testDateTest() {
        String params = "{'test':'2020-12-30 13:39:02'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patch("/testDate/", jsonStr);
        
    }
    @Test
    public void testBodyTest() {
        String params = "{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.08767306819108911,'floatTest':0.83181053,'intTest':1,'longTest':1,'strArray':['广安55','猪安小小四公'],'stringList':['狗1狗安','尔告小','广个猫猫'],'stringTest':'第2告猫猪','testObjectArray':[{'booleanTest':true,'byteTest':0,'dateTest':'2020-12-30 13:39:02','doubleTest':0.5368373203160266,'floatTest':0.20989507,'intTest':1,'longTest':1,'stringTest':'小1省'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.2947956328681891,'floatTest':0.2969408,'intTest':0,'longTest':3,'stringTest':'告司小42狗'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.9761687081806233,'floatTest':0.86346424,'intTest':1,'longTest':1,'stringTest':'猪第安'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.7888742471292322,'floatTest':0.76295483,'intTest':0,'longTest':2,'stringTest':'三安第安狗5'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.6028032359257627,'floatTest':0.036631644,'intTest':0,'longTest':3,'stringTest':'告狗狗'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.7753557619816255,'floatTest':0.9878926,'intTest':0,'longTest':2,'stringTest':'猫的'}],'testObjectList':[{'booleanTest':true,'byteTest':0,'dateTest':'2020-12-30 13:39:02','doubleTest':0.9571023648098465,'floatTest':0.06875718,'intTest':0,'longTest':3,'stringTest':'故个个3'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.6467121243397171,'floatTest':0.6242465,'intTest':1,'longTest':2,'stringTest':'小3'},{'booleanTest':true,'byteTest':0,'dateTest':'2020-12-30 13:39:02','doubleTest':0.31470868271286256,'floatTest':0.53548414,'intTest':1,'longTest':0,'stringTest':'公小'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.6593043670402183,'floatTest':0.8595889,'intTest':0,'longTest':3,'stringTest':'司事司东安'},{'booleanTest':false,'byteTest':0,'dateTest':'2020-12-30 13:39:02','doubleTest':0.5371893673517728,'floatTest':0.20163757,'intTest':0,'longTest':3,'stringTest':'的小'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.7635799362261606,'floatTest':0.89527726,'intTest':0,'longTest':1,'stringTest':'东0'}],'testObjectMap':{'第小司5狗省':'808','事小安省小猫':'771','狗四安省':'9776'}}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.patchBody("/testRequestBody/", jsonStr);
        
    }
}
